package com.qf.grabtickets.cofig;

import com.qf.canstants.Constants;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @version 1.0
 * @Author liujinchi
 * @Date 2023/3/11 9:32
 * @注释
 */
@Configuration
public class MQConfig {

    @Bean
    public FanoutExchange exchange(){
       return new FanoutExchange(Constants.EXCHANGE_NAME,true,false);
    }
    @Bean("queueES")
    public Queue queueES(){

        return new Queue(Constants.QUEUEES,true,false,false);
    }
    @Bean("queueSQL")
    public Queue queueSQL(){

        return new Queue(Constants.QUEUESQL,true,false,false);
    }
    @Bean("bindES")
    public Binding binding(){
        return BindingBuilder.bind(queueES()).to(exchange());
    }
    @Bean("bindSQL")
    public Binding binding1(){
        return BindingBuilder.bind(queueSQL()).to(exchange());
    }
}
